import FetchHelper from "../helper/fetch-helper";

export default class FxpgApi{
    static async xzzh_findby(){
        return {
            data:[
                {
                    xh:'1',
                    zhdmc:'习家坝泥石流',
                    lx:'泥石流',
                    dq:'旺苍县',
                    cz:''
                },
                {
                    xh:'2',
                    zhdmc:'邓家崖崩塌',
                    lx:'崩塌',
                    dq:'昭化区',
                    cz:''
                },
                {
                    xh:'3',
                    zhdmc:'腾家岩危岩',
                    lx:'崩塌',
                    dq:'昭化区',
                    cz:''
                },
            ]
        }
    }
    //风险评估列表
    static async list(params){
        //console.log('list',params)
        try{
            const resp=await FetchHelper.getJson(`/admin-api/ybyj/fxpg/list`,{
                ...params
            })
            resp.rows=resp?.rows?.map(item=>{
                if(item?.xq){
                    try{
                        const json=JSON.parse(item?.xq);
                        return{
                            ...json,
                            ...item,
                        }
                    }catch(e){

                    }
                }
                return item;
            })
            return resp;
        }catch(err){
            return {rows:[]}
        }
    }
    //风险评估报告管理-新增
    static async fxpgbbglAddDynamicApi(){
        const fxpgbbglAddDynamicApi=await FetchHelper.getJson(`${process.env.PUBLIC_URL}/datas/风险评估报告管理新增.json`)
        return fxpgbbglAddDynamicApi;
    }

    
    static async fxpgbggltDynamicApi(){
        const fxpgbgglDynamicForms=await FetchHelper.getJson(`${process.env.PUBLIC_URL}/datas/风险评估报告管理查看.json`)
        return fxpgbgglDynamicForms;
    }
    // //根据id导出
    // static async IdPost(){
    //     const resp=await FetchHelper.postJson('/admin-api/ybyj/fxpg/export',{id:'297ed3eb8a1c5bed018a1c5ce2a00000'})
    //     return resp;
    // }
}